package com.jinke.api.modules.ums.vo;

import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jinke.api.modules.app.enums.ChannelStatus;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Accessors(chain = true)
public class ChannelPageVO {
    @ApiModelProperty(value = "渠道ID")
    private Integer channelId;
    @ApiModelProperty(value = "渠道名称")
    private String channelName;
    @ApiModelProperty(value = "渠道平台id")
    private Integer channelPlatformId;
    @ApiModelProperty(value = "渠道code")
    private String channelCode;
    @ApiModelProperty(value = "货运商运输服务code")
    private String serviceCode;
    @ApiModelProperty(value = "货运商id")
    private Integer channelCarrierId;
    @ApiModelProperty(value = "渠道原始名称")
    private String channelOriginName;
    @ApiModelProperty(value = "溢价费率")
    private BigDecimal rate;
    @ApiModelProperty(value = "溢价")
    private BigDecimal price;
    @ApiModelProperty(value = "是否最优")
    private Integer isBest;
    @ApiModelProperty(value = "是否最优描述")
    private String isBestDesc;
    @ApiModelProperty(value = "混比")
    private Integer platformRate;
    @ApiModelProperty(value = "是否启用")
    private ChannelStatus status;
    @ApiModelProperty(value = "是否启用描述")
    private String statusDesc;
    @ApiModelProperty(value = "备注")
    private String note;
    @ApiModelProperty(value = "地址ID")
    private String uuid;
    @ApiModelProperty(value = "postCard")
    private String postCard;
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime createdAt;

    public String getIsBestDesc() {
        return ObjectUtil.isNull(this.isBest) ? "未知" : this.isBest.equals(0) ? "最优" : "混比";
    }
    public String getStatusDesc() {
        return ObjectUtil.isNull(this.status) ? "未知" : this.status.getDesc();
    }
}
